<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8"/>
<title>Login</title>
</head>

<body>
<input id="ifexistname" style="display: none" th:value="${ifexistname}" type="hidden"/>

	<div>
		<form action="/websocket" method="post">
			<input type="text" class="form-control" name="username" id="username" placeholder="用户名"/>
			<input type="password" class="form-control" name="password" id="password" placeholder="密码"/>
			<button type="submit" class="btn btn-primary btn-block">登录</button>
		</form>
	</div>
</body>

<script type="text/javascript">
	(function(){
	var ifexistname=document.getElementById('ifexistname').value;
	var yesno="yes";
	if(ifexistname === yesno)
		alert("用户名已存在!");
	}());
	$(function (){
		$("#username").blur(function (){
			if ($("#username").val()==""||$("#username").val()==null){
				alert("用户名不能为空");
			}
		})
		$("#password").blur(function (){
			if ($("#password").val()==""||$("#password").val()==null){
				alert("密码不能为空");
			}
		})

	});
</script>
</html>